<template name="Search">
  <form action="#" method="get" class="sidebar-form" id="search-form">
    <div class="input-group">
      <input type="text" name="search" class="form-control" placeholder="{{_ 'search_action'}}">
      <span class="input-group-btn">
        <button type="button" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
        </button>
      </span>
    </div>
  </form>
</template>

<template name="SearchModal">
  <div class="modal fade full-screen no-footer search">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <div class="input-group">
            {{> EasySearch.Input index=threadsIndex attributes=inputAttributes event='enter' noDocumentsOnEmpty=true}}
            <span class="input-group-btn">
              <button class="btn btn-default" type="button" data-dismiss="modal" aria-label="Close">{{_ 'app_action_cancel'}}</button>
            </span>
          </div>
        </div>
        <div class="modal-body scroll-box">
          <ul class="list-group threads">
            {{#EasySearch.IfNoResults index=threadsIndex}}
              <div>{{_ 'app_no_record'}}</div>
            {{/EasySearch.IfNoResults}}
            {{#EasySearch.IfSearching index=threadsIndex}}
              <div>{{> spinner}}</div>
            {{/EasySearch.IfSearching}}
            {{#EasySearch.Each index=threadsIndex}}
              {{> ThreadListItemTemplate thread}}
            {{/EasySearch.Each}}
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>

<template name="ThreadDetailSearch">
  <div class="panel flat-panel">
    <div class="flat-panel-heading">
      <div class="flat-panel-title" id="btn-search">
        <i class="fa fa-search"></i> {{_ 'search_thread_messages'}}
      </div>
    </div>
  </div>
</template>

<template name="ThreadSearchModal">
  <div class="modal fade full-screen no-footer search">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <div class="input-group">
            {{> EasySearch.Input index=messagesIndex attributes=inputAttributes event='enter' noDocumentsOnEmpty=true}}
            <span class="input-group-btn">
              <button class="btn btn-default" type="button" data-dismiss="modal" aria-label="Close">{{_ 'app_action_cancel'}}</button>
            </span>
          </div>
        </div>
        <div class="modal-body scroll-box messages">
          {{#EasySearch.IfNoResults index=messagesIndex}}
            <div>{{_ 'app_no_record'}}</div>
          {{/EasySearch.IfNoResults}}
          {{#EasySearch.IfSearching index=messagesIndex}}
            <div>{{> spinner}}</div>
          {{/EasySearch.IfSearching}}
          {{#EasySearch.Each index=messagesIndex}}
            {{> Message}}
          {{/EasySearch.Each}}
        </div>
      </div>
    </div>
  </div>
</template>
